<template>
  <div class="barg_container">
    <!-- 标题/返回按钮 -->
    <NavigationBar></NavigationBar>
      <!-- 砍价主页商品 右图左文字 -->
      <div class="bargitem_wrapper">
        <div class="bargitem_wrapper_item" 
           v-for="(item,index) in BargList" 
           :key="index"
           @click="goDetail(item.id)">
            <!-- 图片 -->
        <div class="bargitem_item_img">
              <img :src="item.pic">
        </div>
          <!-- 文字单价部分 -->
        <div class="bargitem_item_right">
            <div class="bargitem_item_right_top">
                <span style="fontSize:0.7rem;margin-bottom:5px">{{item.name}}</span>
                <span style="fontSize:0.5rem;color:#ddd">{{item.characteristic}}</span>
            </div>
            <div class="bargitem_item_right_bottom">
                <div class="bargitem_item_right_bottom_left bargitem_item_right_bottom_item">
                    <span style="color:red;margin-bottom:5px">￥{{item.minPrice}}</span>
                    <span>低价</span>
                </div>
                <div class="bargitem_item_right_bottom_center bargitem_item_right_bottom_item">
                    <span style="color:#ddd">￥{{item.originalPrice}}</span>
                    <span style="color:#ddd">原价</span>
                </div>
                <div class="bargitem_item_right_bottom_right bargitem_item_right_bottom_item">
                    <span style="color:#ddd">{{item.stores}}</span>
                    <span style="color:#ddd">限量</span>
                </div>
            </div>
        </div>
        </div>
      </div>
  </div>
</template>

<script>
import NavigationBar from "../components/headerNav/NavigationBar";
import PATH from "../router/constant"
export default {
  components:{
    NavigationBar
  },
  data() {
        return {
            BargList : []
        }
    },
  mounted(){
    this.$CLIENT.getBarg().then(res=>{
            this.BargList = res.data.data.goodsMap
    }).catch((error)=>{
            console.log(error)
    })
  },
  methods:{
    // goDetail(id){
    //   this.$router.pushRouteQuery('/bragDetail',{id:id})
    // },
    goDetail(id){
      this.$router.goNext({path:PATH.PAPULARBAR,query:{id}})
    }
  }
}
</script>

<style scoped>
.barg_container
{
  width: 100%;
  height: 100vh;
}

.barg_header
{
  width: 100%;
  height: 50px;
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
}

.barg_header_icon
{
  width: 10%;
  height: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.barg_header_icon img
{
  width: 24px;
  height: 24px;
}

.barg_header_title
{
  width: 90%;
  height: 100%;
  text-align: center;
  line-height: 50px;
  font-size: 15px;
}

/* 商品列表 */
.bargitem_wrapper
{
    width: 100%;
    height: 100%;
    margin-top: 64px;
    margin-bottom: 64px;
}

.bargitem_wrapper_item
{
    display: inline-flex;
    justify-content: space-between;
    padding: 5px;
    /* margin-bottom: 60px; */
    box-sizing: border-box;
    border-top: 1px solid #eee;
}

.bargitem_item_img
{
    width: 40%;
    height: 100%;
}

.bargitem_item_img img 
{
    width: 100%;
    /* height: 100%; */
    border-radius: 5px;
}

/* 图片右侧内容样式 */
.bargitem_item_right
{
    width: 100%;
    height: 133px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.bargitem_item_right_top
{
    width: 90%;
    height: 30%;
    /* background-color: red; */
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
}

.bargitem_item_right_bottom
{
    width: 90%;
    height: 40%;
    /* background-color: #000; */
    margin-top: 1rem;
    display: inline-flex;
    justify-content: space-around;
}

.bargitem_item_right_bottom_item
{
    width: 25%;
    height: 100%;
    /* background-color: green; */
    font-size:0.7rem;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}
</style>